package com.yetm.springbootdemo.controller;

import com.yetm.springbootdemo.entity.User;
import com.yetm.springbootdemo.service.UserService;
import com.yetm.springbootdemo.utils.Result;
import com.yetm.springbootdemo.utils.ResultGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private ResultGenerator resultGenerator;

    @GetMapping(value = "/getUser/{id}")
    public Result getUser(@PathVariable("id") String id) {
        User user = userService.getUser(id);
        return resultGenerator.successResult(user);
    }

}
